var t = require("../../../../ec-canvas/echarts"), a = getApp();

Page({
    data: {
        language: "",
        ec: {
            lazyLoad: !0
        },
        total: "",
        month: "",
        today: "",
        recent: "",
        xdate: [],
        ydate: []
    },
    onLoad: function(t) {
        this.echartsComponnet = this.selectComponent("#mychart"), this._getPerformance();
    },
    onReady: function() {
        var t = wx.getStorageSync("langIndex");
        this.setData({
            language: t.en
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    _getPerformance: function() {
        var t = this, e = a.getNetAddresss("finance.OrderAll");
        a._getNetWork({
            url: e,
            success: function(a) {
                var e = a.data;
                if (1 == e.result) {
                    for (var n in t.setData({
                        total: e.data.all,
                        month: e.data.month,
                        today: e.data.today,
                        recent: e.data.recent
                    }), t.data.recent) {
                        var o = t.data.xdate, i = t.data.ydate;
                        o.push(t.data.recent[n].date), i.push(t.data.recent[n].price), t.setData({
                            xdate: o,
                            ydate: i
                        });
                    }
                    t.init_echarts();
                } else wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t.msg);
            }
        });
    },
    init_echarts: function() {
        var a = this;
        this.echartsComponnet.init(function(e, n, o) {
            var i = t.init(e, null, {
                width: n,
                height: o
            });
            return i.setOption(a.getOption()), i;
        });
    },
    getOption: function() {
        return {
            title: {
                text: "最近7天营业额(万元)",
                textStyle: {
                    fontSize: 14,
                    color: "#FF5511"
                }
            },
            xAxis: {
                type: "category",
                data: this.data.xdate,
                boundaryGap: !1,
                axisLabel: {
                    fontSize: 14,
                    fontFamily: "Arial",
                    interval: 0,
                    rotate: 30
                }
            },
            yAxis: {
                type: "value",
                axisLabel: {
                    fontFamily: "Arial"
                }
            },
            series: [ {
                data: this.data.ydate,
                type: "line",
                hoverAnimatio: !0
            } ]
        };
    }
});